package main

import (
	"fmt"
	"time"
)

// 异常处理
func main() {
	go sayHello()
	go test()
	time.Sleep(time.Second * 12)
}
func sayHello() {
	for i := 0; i < 10; i++ {
		time.Sleep(time.Second)
		fmt.Println("hello,word")
	}
}
func test() {
	// 使用 defer recover 处理
	defer func() {
		if err := recover(); err != nil {
			fmt.Println("发送错误", err)
		}
	}()
	var map1 map[string]string
	map1["k"] = "going"
}
